package com.zhongyu.hellocloudgradeprovider.controller;


import com.zhongyu.pojo.Grade;
import com.zhongyu.service.GradeService;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


import javax.annotation.Resource;
import java.util.List;

@RestController
public class GradeController {
    @Resource
    private GradeService gradeService;


    @RequestMapping(value = "/grade/getById")
    public Grade getGradeById(@RequestParam("gradeId") Integer id){
        try {
            Thread.sleep(5000);
        }
        catch (Exception ex){
            ex.printStackTrace();
        }

    return gradeService.getGradeById(id);
    }

    @RequestMapping(value = "/grade/getList")
    public List<Grade> getGrades(){

        int a=1/0;
        return  gradeService.getGrades();
    }

    @RequestMapping(value = "/hello")
    @ResponseBody
    public String hello(){
        return "hello";
    }








}
